package com.jili.single;

/**
 * ClassName: LiskovDemo
 * Package com.jili.single
 * Description:
 *
 * @Author: 廖继礼
 * @Create: 2024/7/27
 * @Version: v1.0
 */
public class LiskovDemo {
    public static void main(String[] args) {
        B  b1 = new B();
        // 因为B类不再继承A类，调用完成的功能就会很明确
        System.out.println("b1.fun1(8, 3) = " + b1.fun3(8, 3));
    }
}

class Base{
    // 把更加的方法和成员写到Base类
}
class A extends Base{
    public int fun1(int a, int b){
        return a - b;
    }
}
class B extends Base {

    private A a = new A();

    public int fun3(int a, int b){
        return this.a.fun1(a, b);
    }
}